<template>
  <div>
    <div class="background-white">
      <div class="add-padding">
        <el-row class="reset-row">
          <el-col :span="3" :offset="2"><span style="color: #cc0000">*</span>姓名:</el-col>
          <el-col :span="8">
            <el-input
              placeholder="请输入姓名"
              v-model="name"
              clearable>
            </el-input>
          </el-col>
        </el-row>
        <el-row class="reset-row">
          <el-col :span="3" :offset="2"><span style="color: #cc0000">*</span>手机号:</el-col>
          <el-col :span="8">
            <el-input
              placeholder="请输入手机号"
              v-model="name"
              clearable>
            </el-input>
          </el-col>
        </el-row>
        <el-row class="reset-row">
          <el-col :span="3" :offset="2"><span style="color: #cc0000">*</span>分配角色:</el-col>
          <el-col :span="8">
            <el-select v-model="role" placeholder="请选择角色">
              <el-option
                v-for="item in roles"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-col>
        </el-row>
        <el-row class="reset-row">
          <el-col :span="3" :offset="2"><span style="color: #cc0000">*</span>设置密码:</el-col>
          <el-col :span="8">
            <el-input
              placeholder="设置密码"
              v-model="pass"
              clearable>
            </el-input>
          </el-col>
        </el-row>
      </div>
      <div class="btn-action">
        <el-row>
          <el-col :span="6" :offset="5">
            <el-button type="danger">保存</el-button>
            <el-button v-if="isEdit" @click="deleteRow(1)">删除</el-button>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "update",
    props: {
      isEdit: {
        type: Boolean,
        default: false
      },
      isAdd: {
        type: Boolean,
        default: false
      },
      editObj: {
        type: Object,
        default: () => {
          return {};
        }
      },
      name: {
        type: String,
        default: ''
      },
      phone: {
        type: String,
        default: ''
      },
      pass: {
        type: String,
        default: ''
      },
      role: {
        type: String,
        default: ''
      },
      roles: {
        type: Array,
        default: () => {
          return [
            {
              value: '选项1',
              label: '黄金糕'
            }, {
              value: '选项2',
              label: '双皮奶'
            }, {
              value: '选项3',
              label: '蚵仔煎'
            }, {
              value: '选项4',
              label: '龙须面'
            }, {
              value: '选项5',
              label: '北京烤鸭'
            }]
        }
      },
    },
    data() {
      return {}
    },
    methods:{
      deleteRow(id){
        this.$emit('deleteRow',{id:id})
      }
    }
  }
</script>

<style scoped lang="scss">
  /*  添加*/
  .add-padding {
    padding-top: 32px;
    border-bottom: 1px solid #f2f2f2;
  }

  .reset-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding-bottom: 16px;
  }

  .btn-action {
    padding-top: 16px;
    padding-bottom: 22px;
  }
</style>
